﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;

namespace Beat_em_Up.Scenes
{
    public class Scene_01
    {
        HUD hud;

        /// <summary>
        /// Este é nosso objeto jogador
        /// </summary>
        Player player;

        Object3D galpao;

        Vector3 posCamera;

        /// <summary>
        /// Esta é minha câmera, única no jogo?
        /// </summary>
        Camera camera;

        public Scene_01(ContentManager Content, Game game1)
        {
            posCamera = new Vector3(0, 0, 0);
    
            camera = new Camera(game1, posCamera);
            //posso passar mais duas sobrecargas...
            //mas como está ela vai apontar para o 0,0,0 com Up     

            player = new Player(Content.Load<Model>("Models/player"), Vector3.Zero);
            //no meio com escala 1

            hud = new HUD(Content);

            galpao = new Object3D(Content.Load<Model>("Models/teste/teste"), Vector3.Zero, 1f);
        }

        public void Update(GameTime gameTime, KeyboardState currentKeyboard, KeyboardState oldKeyboard )
        {
            if (currentKeyboard.IsKeyDown(Keys.U))
            {
                camera.position.Z += 0.1f;
            }

            else if (currentKeyboard.IsKeyDown(Keys.J))
            {
                camera.position.Z -= 0.1f;
            }

            if (currentKeyboard.IsKeyDown(Keys.Z))
            {
                camera.position.Y += 0.1f;
            }

            else if (currentKeyboard.IsKeyDown(Keys.X))
            {
                camera.position.Y -= 0.1f;
            }

            if (currentKeyboard.IsKeyDown(Keys.K))
            {
                camera.position.X += 0.1f;
            }

            else if (currentKeyboard.IsKeyDown(Keys.H))
            {
                camera.position.X -= 0.1f;
            }

            player.Update(gameTime);
            camera.Update(gameTime);
            player.playerMovement(gameTime, currentKeyboard, oldKeyboard);
            hud.Update(gameTime, currentKeyboard, oldKeyboard);
            galpao.Update(gameTime);
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            player.Draw(camera);
            hud.Draw(gameTime, spriteBatch);
            galpao.Draw(camera);
        }
    }
}